import requests
from config import url, headers_web


class UserLogin:

    def __int__(self):
        self.url = url
        self.headers = headers_web

    @classmethod
    def unifiedlogin(cls, url: str, params=None,json=None,headers = headers_web):
        """
        @Summary:用户统一登录接口,如开启单点登录使用学校用户名密码登录，否则使用自带用户名密码登录
        @Description:1.互动课堂-账号密码登录
        :param url:
        :param params:
        :return:
        """
        url = url + "/authoritycontrolplatformapi/api/v1/unifiedlogin"
        r = requests.post(url=url, headers=headers, params=params,json=json)

        return r

if __name__ == '__main__':
    resp = UserLogin.unifiedlogin(url=url, params={
        "validCode":"155cc6439a2bd898c289a0a86ee1058c"},json={
        "userAccountNo":"2008115582",
        "password":"123456"
    })
    print(resp.url, "\n", resp, resp.content)
    print(resp.request.headers, "\n", resp.request.method)